package lifecycle;

/**
 * @ClassName : LifecycleBase
 * @Description : 定义各个容器的生命周期实现类
 * @Author : zhangxiaohai
 * @Date: 2021-06-24 08:26
 */
public abstract class LifecycleBase implements Lifecycle {

    protected abstract void initInternal() throws Exception;

    @Override
    public void init() throws Exception {
        System.out.println(this.getClass().getName() + "  init begin");
        initInternal();
        System.out.println(this.getClass().getName() + "  init finished");
    }

    @Override
    public void start() {
        System.out.println(this.getClass().getName() + "  start begin");
        startInternal();
        System.out.println(this.getClass().getName() + "  start finished");
    }

    protected abstract void startInternal();
}
